package com.grad.webstudy.dao;

import com.grad.webstudy.model.CourseChapter;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public interface CourseChapterDao {
    int deleteByPrimaryKey(Integer id);


    int insertSelective(CourseChapter record);

    CourseChapter selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(CourseChapter record);

    int updateByPrimaryKey(CourseChapter record);


    /**
     * 插入单个章节
     * @param record
     * @return
     */
    int insert(CourseChapter record);


    /**
     * 批量插入章节信息
     * @param chapters
     * @return
     */
    int insertChapters(List<CourseChapter> chapters);


    /**
     * 根据id批量删除章节
     * @param ids
     * @return
     */
    int deleteChaptersByIds(List<String> ids);


    /**
     * 根据课程id删除章节信息
     * @param courseId
     * @return
     */
    int deleteChapterByCourseId(Integer courseId);


    /**
     * 更新章节信息
     * @param courseChapter
     * @return
     */
    int updateChapter(CourseChapter courseChapter);

    /**
     * 根据课程id查询所属章节信息
     * @param courseId
     * @return
     */
    List<CourseChapter> queryAllGroupByCourseId(Integer courseId);
}